<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .div1 {
      width: 300px;
      height: 300px;
      padding: 50px;
      background-color: #fff00f
    }

    .div2 {
      background-color: #f00;
    }
  </style>
</head>

<body>

  <div id="app">
    <!-- <div class="div1" @click="fn2">
      div1
      <div class="div2" @click.stop="fn1">
        <div>2</div>
      </div>
    </div> -->
    <div>
      <a href="./todolist.html" @click.prevent="fn3">todolist</a>
    </div>
    <!-- 捕获事件流 -->
    <!-- <div class="div1" @click.capture="fn2">
      div1
      <div class="div2" @click.capture="fn1">
        <div>2</div>
      </div>
    </div> -->

    <!-- event.target 是自己，自己触发了自己绑定的事件，而不是子元素冒泡事件流触发的。-->
    <!-- <div class="div1" @click.self="fn2">
      div1
      <div class="div2" @click="fn1">
        <div>2</div>
      </div>
    </div> -->
    <!-- 
    <div class="div1" @click.capture.self="fn2">
      div1
      <div class="div2" @click.capture="fn1">
        <div>2</div>
      </div>
    </div> -->

    <!-- <div><input type="text" v-model="text" @keyup.enter="searchFn"></div> -->
    <!-- 自定义的一个键名： -->
    <div><input type="text" v-model="text" @keyup.myenter="searchFn"></div>

  </div>

  <script src="./js/vue.js"></script>
  <script>
    // 全局自定义一个按键修饰符：
    Vue.config.keyCodes.myenter = 13;
    let vm = new Vue({
      el: "#app",
      data: {
        text: ''
      },
      methods: {
        fn1() {
          console.log('fn1');
        },
        fn2() {
          console.log('fn2');

        },
        fn3() {
          console.log("fn3");
        },
        searchFn() {
          console.log(this.text);
        }

      },
      computed: {},
      watch: {}
    })

  </script>
</body>

</html>